package nl.saxion.database.beerology;

import android.database.sqlite.SQLiteDatabase;

public class DatabaseTable
{
	public static void onCreate(SQLiteDatabase database)
	{
		database.execSQL("PRAGMA foreign_keys = ON;");
		
		database.execSQL("CREATE TABLE IF NOT EXISTS Bieren (" +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
						"brouwerijen_id INTEGER," +
						"naam CHARACTER," + 
						"alcoholpercentage REAL," +
						"FOREIGN KEY(brouwerijen_id) REFERENCES Brouwerijen(_id)" +
						")"
						);
		
		database.execSQL("CREATE TABLE IF NOT EXISTS Brouwerijen (" +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
						"naam CHARACTER," +
						"plaats CHARACTER," +
						"land CHARACTER" +
						")"
						);
		
		database.execSQL("CREATE TABLE IF NOT EXISTS Reviews (" +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
						"geschonken_id INTEGER," +
						"datum DATETIME," +
						"locatie CHARACTER," +
						"rating REAL," +
						"opmerking CHARACTER," +
						"FOREIGN KEY(geschonken_id) REFERENCES Geschonken(_id)" +
						")"
						);
		
		database.execSQL("CREATE TABLE IF NOT EXISTS Geschonken (" +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
						"naam CHARACTER" +
						")"
						);
		
		database.execSQL("CREATE TABLE IF NOT EXISTS Fotos (" +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
						"bieren_id INTEGER," +
						"url CHARACTER," +
						"FOREIGN KEY(bieren_id) REFERENCES Bieren(_id)" +
						")"
						);
	}
}
